import {$t} from '#/locales'
const RADIO = 'radio'//单选题
const CHECKBOX = "checkbox"//多选题
const TRUE_FALSE = 'trueFalse'//判断题
const FILL_BLANK = 'fillBlank'//填空题
const ESSAY = 'essay'//问答
const COMPOSITE = 'composite'//组合
type ConfigKey = 'questionShuffle' | 'optionShuffle' | 'suppressSwitchingScreen' | 'suppressCopyAndPaste' | 'deviceCheck';
type CountKey = 'suppressSwitchingScreenCount' | 'suppressCopyAndPasteCount';

interface ConfigurationItem {
  key: ConfigKey;
  countKey?: CountKey;
  setTimes?: boolean;
  configTxt: string;
  disabled?: boolean;
}
//题型的options
export const questionTypeOptions = [
  {
    value: RADIO,
    label: $t('common.radioTxt'),
  }, {
    value: CHECKBOX,
    label: $t('common.checkboxTxt'),
  }, {
    value: TRUE_FALSE,
    label: $t('common.trueFalseTxt'),
  }, 
  {
    value: FILL_BLANK,
    label: $t('common.fillBlankTxt'),
  }, {
    value: ESSAY,
    label: $t('common.essayTxt'),
  },
  // {
  //   value: COMPOSITE,
  //   label: $t('common.compositeTxt'),
  // }
]

export const getTypeName = (type: string) => {
  return questionTypeOptions.find(f => f.value === type)
}

export { RADIO, CHECKBOX, TRUE_FALSE, FILL_BLANK, ESSAY, COMPOSITE }


/**
 * edit setting of exam
 */
export const configurationList:ConfigurationItem[] = [
  {configTxt: $t('common.suppressSwitchScreenTxt'), key: 'suppressSwitchingScreen', setTimes: true, disabled: false, countKey: 'suppressSwitchingScreenCount'},
  {configTxt: $t('common.suppressPasteTxt'), key: 'suppressCopyAndPaste', setTimes: true, disabled: false, countKey: 'suppressCopyAndPasteCount'},
  {configTxt: $t('common.deviceCheckTxt'), key: 'deviceCheck', disabled: false},
  {configTxt: $t('common.quesShuffleTxt'), key: 'questionShuffle', disabled: true},
  {configTxt: $t('common.optShuffleTxt'), key: 'optionShuffle', disabled: true},
  // {configTxt: $t('common.examMonitorTxt'), key: 'monitor', disabled: true},
  // {configTxt: $t('common.faceDetectTxt'), key: 'faceDetect', disabled: true},
  // {configTxt: $t('common.aiCheatAnalysisTxt'), key: 'aiAnalysis', disabled: true},
]

/**
 * 成绩分布
 * **/ 
export const distriGrades = [
  { name: `90-100${$t('common.gradesTxt')}`, key: '90<=X<=100', value: 0, percent: 0, color: 'bg-[#0067D1]' },
  { name: `80-89${$t('common.gradesTxt')}`, key: '80<=X<90', value: 0, percent: 0, color: 'bg-[#52C41A]' },
  { name: `60-79${$t('common.gradesTxt')}`, key: '60<=X<80', value: 0, percent: 0, color: 'bg-[#FFA940]' },
  { name: `0-59${$t('common.gradesTxt')}`, key: 'X<60', value: 0, percent: 0, color: 'bg-[#FA541C]' }
]

/**
 * 批改状态的点背景颜色
 * **/ 
export const statusBg = {
  "uncorrected":"#E5484D ",
  "correcting":"#FB9A0E",
  "corrected":"#30A46C",
  "published":"#9254DE",
  "examining":"#1677FF",
  "absent":"#909399"
}
